# -*- coding: utf-8 -*-
import os

DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))

ADMINS = (
    ('morz', 'morz@edisign.ru'),
    ('smiley', 'smiley@edisign.ru'),
)
MANAGERS = ADMINS

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'smiley@edisign.ru'
EMAIL_HOST_PASSWORD = 'Brag1nAG'
EMAIL_PORT = 587

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '/tmp/oets.db',
        'USER': '',                      
        'PASSWORD': '',                  
        'HOST': '',                      
        'PORT': '',                      
    }
}

TIME_ZONE = 'Europe/Moscow'

LANGUAGE_CODE = 'ru-RU'

LANGUAGES = (
    ('ru', 'Russian'),
    ('en', 'English'),
)

SITE_ID = 1
USE_I18N = True
USE_L10N = True

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/assets/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'

STATICFILES_DIRS = (
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOGIN_URL = '/personal/login/'
LOGIN_REDIRECT_URL = '/'

SECRET_KEY = '~[Iqr/qNznXZ/m]1jjQk+D>*Y)/iv_?0M>A3_LbH{V35Yj7\sR'

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.i18n",
    "django.core.context_processors.debug",
    "django.core.context_processors.request",
    "django.core.context_processors.media",
    'django.core.context_processors.csrf',
    'django.contrib.messages.context_processors.messages',
    'oets.main.context_processors.site',
)
INTERNAL_IPS = ['127.0.0.1']

ROOT_URLCONF = 'oets.urls'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates'),
)


INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.flatpages',
    'django.contrib.humanize',
    'django.contrib.sitemaps',

    'oets.tinymce',
    'oets.filebrowser',
    'oets.treemenus',
    'oets.main',
    'oets.news',
    'oets.documents',
    'oets.promotion',
    'oets.trainings',
    'oets.vacations',
    'oets.repairs',
    'oets.xlwt',
    'oets.xlrd',
    'oets.xlutils',
    'oets.userprofile',
    'oets.background_task',
    #'oets.reminder',
)

AUTH_PROFILE_MODULE = 'userprofile.profile'

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

from local_settings import *

TINYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce.js'
TINYMCE_FILEBROWSER = True
TINYMCE_DEFAULT_CONFIG = {
    'mode' : 'textareas',
    'theme' : 'advanced',
    'plugins' : 'pagebreak,style,layer,table,\
    advhr,advimage,advlink,emotions,inlinepopups,insertdatetime,preview,\
    searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,media,visualchars,nonbreaking,xhtmlxtras',
    'theme_advanced_buttons1' : 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
    'theme_advanced_buttons2' : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,media,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor',
    'theme_advanced_buttons3' : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media, advhr,|,print,|,ltr,rtl,|,fullscreen',
    'theme_advanced_buttons4' : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
    'theme_advanced_toolbar_location' : 'top',
    'theme_advanced_toolbar_align' : 'left',
    'theme_advanced_statusbar_location' : 'bottom',
    'theme_advanced_resizing' : 'true',
}

FILEBROWSER_DEBUG = False